<?php
namespace Admin\Controller;


class ScheduleController extends BaseController {


    public function index() {
        $scheduleArr = M ('Schedule')->select();
        $this->assign('scheduleArr',$scheduleArr);
        $this->display();
    }


    public function handler() {

        if (IS_POST) {

            $data['id'] = I ('request.id',null);
            $data['stime'] = I ('request.stime',null);
            $data['etime'] = I ('request.etime',null);
            $data['length'] = I ('request.length',null);

            if (($flag = \Api\Libs\HttpVerifyUtil::verifyFormParamNotNull($data)) !== '000000')
                $this->out('RESULT_FAIL',\Api\Libs\ExplainRespCodeUtil::explain($flag));

            $Schedule = M ('Schedule');
            $flag = $Schedule->save($data);

            if ($flag === false) {
                $this->out('RESULT_FAIL','修改失败');
            }
            $this->out('RESULT_OK','修改成功');

        }

    }

}